-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: picker增加resistance属性,以支持通过鼠标滚轮进行选择时产生段落感 #6853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6853 +/- ##
==========================================
- Coverage 92.68% 92.67% -0.02%
==========================================
Files 335 335
Lines 7217 7219 +2
Branches 1779 1819 +40
==========================================
+ Hits 6689 6690 +1
- Misses 520 521 +1
Partials 8 8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
const position = scrollY + distance * whellDir + speed | ||
const position = | ||
scrollY + | ||
(distance / (props.wheelResistance ? 4 : 1)) * whellDir + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么 4 就认为是有段落感的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么 4 就认为是有段落感的?
通过rubberbandIfOutOfBounds运算后,滚动差值会在itemHeight以内浮动,如果大于itemHeight,则无法一滚动一行,滚动差值过于小时,由于皮筋效应,会出现卡顿感,所以这个理想值被定在了4,也就是distance应该在25左右
#5052